<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script src="jquery-1.11.3.min.js"></script>
</head>
<body>

	<!-- 本页面访问路径 : http://a.com/index3.html -->

	<a href="#" onclick="get1()">发送get1请求</a>
	<!-- <a href="#" onclick="get2()">发送get2请求</a> -->
	<a href="#" onclick="getCookie()">发送getCookie请求</a>
	<a href="#" onclick="getHeader()">发送getHeader请求</a>
	<script>
	function get1(){
		$.getJSON("/ajaxserver/get1").then(
			function(result){
				console.log(result);
			}		
		);
	}
	
	function getCookie(){
		$.ajax({
			type:"get",
			/* dataType:"json", */
			url:"/ajaxserver/getCookie",
	 		xhrFields:{
				withCredentials:true
			}, 
			success:function(result){
				console.log(result);
			}
		});
	}
	
	function getHeader(){
		$.ajax({
			type:"get",
			url:"/ajaxserver/getHeader",
			headers:{
				"x-header1":"AAA"
			}, 
			beforeSend:function(xhr){
				xhr.setRequestHeader("x-header2","BBB")
			},
			success:function(result){
				console.log(result);
			}
		});
	}
	
/* 	function get2(){
		$.ajax({
			url:"http://localhost:8080/test/get2",
			dataType:"jsonp",
			success:function(json){
				console.log(result);
			}
		});
	} */
	
	</script>

</body>
</html>